home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / man / cmds.fmt / csh.man < prev    next >
Encoding:
Text File  |  1989-01-24  |  79.8 KB  |  2,047 lines

  1.  
  2.  
  3.  
  4. CSH                       User Commands                       CSH
  5.  
  6.  
  7.  
  8. NNAAMMEE
  9.      csh - a shell (command interpreter) with C-like syntax
  10.  
  11. SSYYNNOOPPSSIISS
  12.      ccsshh [ --cceeffiinnssttvvVVxxXX ] [ arg ...  ]
  13.  
  14. DDEESSCCRRIIPPTTIIOONN
  15.      _C_s_h is a first implementation of a command language inter-
  16.      preter incorporating a history mechanism (see HHiissttoorryy SSuubb--
  17.      ssttiittuuttiioonnss), job control facilities (see JJoobbss), interactive
  18.      file name and user name completion (see FFiillee NNaammee CCoommppllee--
  19.      ttiioonn), and a C-like syntax.  So as to be able to use its job
  20.      control facilities, users of _c_s_h must (and automatically)
  21.      use the new tty driver fully described in _t_t_y(4).  This new
  22.      tty driver allows generation of interrupt characters from
  23.      the keyboard to tell jobs to stop.  See _s_t_t_y(1) for details
  24.      on setting options in the new tty driver.
  25.  
  26.      An instance of _c_s_h begins by executing commands from the
  27.      file `.cshrc' in the _h_o_m_e directory of the invoker.  If this
  28.      is a login shell then it also executes commands from the
  29.      file `.login' there.  It is typical for users on crt's to
  30.      put the command ``stty crt'' in their ._l_o_g_i_n file, and to
  31.      also invoke _t_s_e_t(1) there.
  32.  
  33.      In the normal case, the shell will then begin reading com-
  34.      mands from the terminal, prompting with `% '.  Processing of
  35.      arguments and the use of the shell to process files contain-
  36.      ing command scripts will be described later.
  37.  
  38.      The shell then repeatedly performs the following actions: a
  39.      line of command input is read and broken into _w_o_r_d_s.  This
  40.      sequence of words is placed on the command history list and
  41.      then parsed.  Finally each command in the current line is
  42.      executed.
  43.  
  44.      When a login shell terminates it executes commands from the
  45.      file `.logout' in the users home directory.
  46.  
  47.      LLeexxiiccaall ssttrruuccttuurree
  48.  
  49.      The shell splits input lines into words at blanks and tabs
  50.      with the following exceptions.  The characters `&' `|' `;'
  51.      `<' `>' `(' `)' form separate words.  If doubled in `&&',
  52.      `||', `<<' or `>>' these pairs form single words.  These
  53.      parser metacharacters may be made part of other words, or
  54.      prevented their special meaning, by preceding them with `\'.
  55.      A newline preceded by a `\' is equivalent to a blank.
  56.  
  57.      In addition strings enclosed in matched pairs of quotations,
  58.      `'', ``' or `"', form parts of a word; metacharacters in
  59.      these strings, including blanks and tabs, do not form
  60.  
  61.  
  62.  
  63. Sprite v1.0              April 24, 1988                         1
  64.  
  65.  
  66.  
  67.  
  68.  
  69.  
  70. CSH                       User Commands                       CSH
  71.  
  72.  
  73.  
  74.      separate words.  These quotations have semantics to be
  75.      described subsequently.  Within pairs of `'' or `"' charac-
  76.      ters a newline preceded by a `\' gives a true newline char-
  77.      acter.
  78.  
  79.      When the shell's input is not a terminal, the character `#'
  80.      introduces a comment which continues to the end of the input
  81.      line.  It is prevented this special meaning when preceded by
  82.      `\' and in quotations using ``', `'', and `"'.
  83.  
  84.      CCoommmmaannddss
  85.  
  86.      A simple command is a sequence of words, the first of which
  87.      specifies the command to be executed.  A simple command or a
  88.      sequence of simple commands separated by `|' characters
  89.      forms a pipeline.  The output of each command in a pipeline
  90.      is connected to the input of the next.  Sequences of pipe-
  91.      lines may be separated by `;', and are then executed sequen-
  92.      tially.  A sequence of pipelines may be executed without
  93.      immediately waiting for it to terminate by following it with
  94.      an `&'.
  95.  
  96.      Any of the above may be placed in `(' `)' to form a simple
  97.      command (which may be a component of a pipeline, etc.) It is
  98.      also possible to separate pipelines with `||' or `&&' indi-
  99.      cating, as in the C language, that the second is to be exe-
  100.      cuted only if the first fails or succeeds respectively. (See
  101.      _E_x_p_r_e_s_s_i_o_n_s.)
  102.  
  103.      JJoobbss
  104.  
  105.      The shell associates a _j_o_b with each pipeline.  It keeps a
  106.      table of current jobs, printed by the _j_o_b_s command, and
  107.      assigns them small integer numbers.  When a job is started
  108.      asynchronously with `&', the shell prints a line which looks
  109.      like:
  110.  
  111.           [1] 1234
  112.  
  113.      indicating that the job which was started asynchronously was
  114.      job number 1 and had one (top-level) process, whose process
  115.      id was 1234.
  116.  
  117.      If you are running a job and wish to do something else you
  118.      may hit the key ^^ZZ (control-Z) which sends a STOP signal to
  119.      the current job.  The shell will then normally indicate that
  120.      the job has been `Stopped', and print another prompt.  You
  121.      can then manipulate the state of this job, putting it in the
  122.      background with the _b_g command, or run some other commands
  123.      and then eventually bring the job back into the foreground
  124.      with the foreground command _f_g.  A ^^ZZ takes effect immedi-
  125.      ately and is like an interrupt in that pending output and
  126.  
  127.  
  128.  
  129. Sprite v1.0              April 24, 1988                         2
  130.  
  131.  
  132.  
  133.  
  134.  
  135.  
  136. CSH                       User Commands                       CSH
  137.  
  138.  
  139.  
  140.      unread input are discarded when it is typed.  There is
  141.      another special key ^^YY which does not generate a STOP signal
  142.      until a program attempts to _r_e_a_d(2) it.  This can usefully
  143.      be typed ahead when you have prepared some commands for a
  144.      job which you wish to stop after it has read them.
  145.  
  146.      A job being run in the background will stop if it tries to
  147.      read from the terminal.  Background jobs are normally
  148.      allowed to produce output, but this can be disabled by giv-
  149.      ing the command ``stty tostop''.  If you set this tty
  150.      option, then background jobs will stop when they try to pro-
  151.      duce output like they do when they try to read input.
  152.  
  153.      There are several ways to refer to jobs in the shell.  The
  154.      character `%' introduces a job name.  If you wish to refer
  155.      to job number 1, you can name it as `%1'.  Just naming a job
  156.      brings it to the foreground; thus `%1' is a synonym for `fg
  157.      %1', bringing job 1 back into the foreground.  Similarly
  158.      saying `%1 &' resumes job 1 in the background.  Jobs can
  159.      also be named by prefixes of the string typed in to start
  160.      them, if these prefixes are unambiguous, thus `%ex' would
  161.      normally restart a suspended _e_x(1) job, if there were only
  162.      one suspended job whose name began with the string `ex'.  It
  163.      is also possible to say `%?string' which specifies a job
  164.      whose text contains _s_t_r_i_n_g, if there is only one such job.
  165.  
  166.      The shell maintains a notion of the current and previous
  167.      jobs.  In output pertaining to jobs, the current job is
  168.      marked with a `+' and the previous job with a `-'.  The
  169.      abbreviation `%+' refers to the current job and `%-' refers
  170.      to the previous job.  For close analogy with the syntax of
  171.      the _h_i_s_t_o_r_y mechanism (described below), `%%' is also a
  172.      synonym for the current job.
  173.  
  174.      SSttaattuuss rreeppoorrttiinngg
  175.  
  176.      This shell learns immediately whenever a process changes
  177.      state.  It normally informs you whenever a job becomes
  178.      blocked so that no further progress is possible, but only
  179.      just before it prints a prompt.  This is done so that it
  180.      does not otherwise disturb your work.  If, however, you set
  181.      the shell variable _n_o_t_i_f_y, the shell will notify you immedi-
  182.      ately of changes of status in background jobs.  There is
  183.      also a shell command _n_o_t_i_f_y which marks a single process so
  184.      that its status changes will be immediately reported.  By
  185.      default _n_o_t_i_f_y marks the current process; simply say
  186.      `notify' after starting a background job to mark it.
  187.  
  188.      When you try to leave the shell while jobs are stopped, you
  189.      will be warned that `You have stopped jobs.'  You may use
  190.      the _j_o_b_s command to see what they are.  If you do this or
  191.      immediately try to exit again, the shell will not warn you a
  192.  
  193.  
  194.  
  195. Sprite v1.0              April 24, 1988                         3
  196.  
  197.  
  198.  
  199.  
  200.  
  201.  
  202. CSH                       User Commands                       CSH
  203.  
  204.  
  205.  
  206.      second time, and the suspended jobs will be terminated.
  207.  
  208.      FFiillee NNaammee CCoommpplleettiioonn
  209.  
  210.      When the file name completion feature is enabled by setting
  211.      the shell variable _f_i_l_e_c (see sseett), _c_s_h will interactively
  212.      complete file names and user names from unique prefixes,
  213.      when they are input from the terminal followed by the escape
  214.      character (the escape key, or control-[).  For example, if
  215.      the current directory looks like
  216.                DSC.OLD   bin       cmd       lib       xmpl.c
  217.                DSC.NEW   chaosnet  cmtest    mail      xmpl.o
  218.                bench     class     dev       mbox      xmpl.out
  219.      and the input is
  220.                % vi ch<escape>
  221.      _c_s_h will complete the prefix ``ch'' to the only matching
  222.      file name ``chaosnet'', changing the input line to
  223.                % vi chaosnet
  224.      However, given
  225.                % vi D<escape>
  226.      _c_s_h will only expand the input to
  227.                % vi DSC.
  228.      and will sound the terminal bell to indicate that the expan-
  229.      sion is incomplete, since there are two file names matching
  230.      the prefix ``D''.
  231.  
  232.      If a partial file name is followed by the end-of-file char-
  233.      acter (usually control-D), then, instead of completing the
  234.      name, _c_s_h will list all file names matching the prefix.  For
  235.      example, the input
  236.                % vi D<control-D>
  237.      causes all files beginning with ``D'' to be listed:
  238.                DSC.NEW   DSC.OLD
  239.      while the input line remains unchanged.
  240.  
  241.      The same system of escape and end-of-file can also be used
  242.      to expand partial user names, if the word to be completed
  243.      (or listed) begins with the character ``~''.  For example,
  244.      typing
  245.                cd ~ro<escape>
  246.      may produce the expansion
  247.                cd ~root
  248.  
  249.      The use of the terminal bell to signal errors or multiple
  250.      matches can be inhibited by setting the variable _n_o_b_e_e_p.
  251.  
  252.      Normally, all files in the particular directory are candi-
  253.      dates for name completion.  Files with certain suffixes can
  254.      be excluded from consideration by setting the variable _f_i_g_-
  255.      _n_o_r_e to the list of suffixes to be ignored.  Thus, if _f_i_g_-
  256.      _n_o_r_e is set by the command
  257.                % set fignore = (.o .out)
  258.  
  259.  
  260.  
  261. Sprite v1.0              April 24, 1988                         4
  262.  
  263.  
  264.  
  265.  
  266.  
  267.  
  268. CSH                       User Commands                       CSH
  269.  
  270.  
  271.  
  272.      then typing
  273.                % vi x<escape>
  274.      would result in the completion to
  275.                % vi xmpl.c
  276.      ignoring the files "xmpl.o" and "xmpl.out".  However, if the
  277.      only completion possible requires not ignoring these suf-
  278.      fixes, then they are not ignored.  In addition, _f_i_g_n_o_r_e does
  279.      not affect the listing of file names by control-D.  All
  280.      files are listed regardless of their suffixes.
  281.  
  282.      SSuubbssttiittuuttiioonnss
  283.  
  284.      We now describe the various transformations the shell per-
  285.      forms on the input in the order in which they occur.
  286.  
  287.      HHiissttoorryy ssuubbssttiittuuttiioonnss
  288.  
  289.      History substitutions place words from previous command
  290.      input as portions of new commands, making it easy to repeat
  291.      commands, repeat arguments of a previous command in the
  292.      current command, or fix spelling mistakes in the previous
  293.      command with little typing and a high degree of confidence.
  294.      History substitutions begin with the character `!' and may
  295.      begin aannyywwhheerree in the input stream (with the proviso that
  296.      they ddoo nnoott nest.) This `!' may be preceded by an `\' to
  297.      prevent its special meaning; for convenience, a `!' is
  298.      passed unchanged when it is followed by a blank, tab, new-
  299.      line, `=' or `('.  (History substitutions also occur when an
  300.      input line begins with `^'.  This special abbreviation will
  301.      be described later.) Any input line which contains history
  302.      substitution is echoed on the terminal before it is executed
  303.      as it could have been typed without history substitution.
  304.  
  305.      Commands input from the terminal which consist of one or
  306.      more words are saved on the history list.  The history sub-
  307.      stitutions reintroduce sequences of words from these saved
  308.      commands into the input stream.  The size of which is con-
  309.      trolled by the _h_i_s_t_o_r_y variable; the previous command is
  310.      always retained, regardless of its value.  Commands are num-
  311.      bered sequentially from 1.
  312.  
  313.      For definiteness, consider the following output from the
  314.      _h_i_s_t_o_r_y command:
  315.  
  316.            9  write michael
  317.           10  ex write.c
  318.           11  cat oldwrite.c
  319.           12  diff *write.c
  320.  
  321.      The commands are shown with their event numbers.  It is not
  322.      usually necessary to use event numbers, but the current
  323.      event number can be made part of the _p_r_o_m_p_t by placing an
  324.  
  325.  
  326.  
  327. Sprite v1.0              April 24, 1988                         5
  328.  
  329.  
  330.  
  331.  
  332.  
  333.  
  334. CSH                       User Commands                       CSH
  335.  
  336.  
  337.  
  338.      `!' in the prompt string.
  339.  
  340.      With the current event 13 we can refer to previous events by
  341.      event number `!11', relatively as in `!-2' (referring to the
  342.      same event), by a prefix of a command word as in `!d' for
  343.      event 12 or `!wri' for event 9, or by a string contained in
  344.      a word in the command as in `!?mic?' also referring to event
  345.      9.  These forms, without further modification, simply rein-
  346.      troduce the words of the specified events, each separated by
  347.      a single blank.  As a special case `!!' refers to the previ-
  348.      ous command; thus `!!' alone is essentially a _r_e_d_o.
  349.  
  350.      To select words from an event we can follow the event
  351.      specification by a `:' and a designator for the desired
  352.      words.  The words of an input line are numbered from 0, the
  353.      first (usually command) word being 0, the second word (first
  354.      argument) being 1, etc.  The basic word designators are:
  355.  
  356.           0    first (command) word
  357.           _n    _n'th argument
  358.           ^    first argument,  i.e. `1'
  359.           $    last argument
  360.           %    word matched by (immediately preceding) ?_s? search
  361.           _x-_y  range of words
  362.           -_y   abbreviates `0-_y'
  363.           *    abbreviates `^-$', or nothing if only 1 word in event
  364.           _x*   abbreviates `_x-$'
  365.           _x-   like `_x*' but omitting word `$'
  366.  
  367.      The `:' separating the event specification from the word
  368.      designator can be omitted if the argument selector begins
  369.      with a `^', `$', `*' `-' or `%'.  After the optional word
  370.      designator can be placed a sequence of modifiers, each pre-
  371.      ceded by a `:'.  The following modifiers are defined:
  372.  
  373.           h      Remove a trailing pathname component, leaving the head.
  374.           r      Remove a trailing `.xxx' component, leaving the root name.
  375.           e      Remove all but the extension `.xxx' part.
  376.           s/_l/_r/ Substitute _l for _r
  377.           t      Remove all leading pathname components, leaving the tail.
  378.           &      Repeat the previous substitution.
  379.           g      Apply the change globally, prefixing the above, e.g. `g&'.
  380.           p      Print the new command line but do not execute it.
  381.           q      Quote the substituted words, preventing further substitutions.
  382.           x      Like q, but break into words at blanks, tabs and newlines.
  383.  
  384.      Unless preceded by a `g' the modification is applied only to
  385.      the first modifiable word.  With substitutions, it is an
  386.      error for no word to be applicable.
  387.  
  388.      The left hand side of substitutions are not regular expres-
  389.      sions in the sense of the editors, but rather strings.  Any
  390.  
  391.  
  392.  
  393. Sprite v1.0              April 24, 1988                         6
  394.  
  395.  
  396.  
  397.  
  398.  
  399.  
  400. CSH                       User Commands                       CSH
  401.  
  402.  
  403.  
  404.      character may be used as the delimiter in place of `/'; a
  405.      `\' quotes the delimiter into the _l and _r strings.  The
  406.      character `&' in the right hand side is replaced by the text
  407.      from the left.  A `\' quotes `&' also.  A null _l uses the
  408.      previous string either from a _l or from a contextual scan
  409.      string _s in `!?_s?'.  The trailing delimiter in the substitu-
  410.      tion may be omitted if a newline follows immediately as may
  411.      the trailing `?' in a contextual scan.
  412.  
  413.      A history reference may be given without an event specifica-
  414.      tion, e.g. `!$'.  In this case the reference is to the pre-
  415.      vious command unless a previous history reference occurred
  416.      on the same line in which case this form repeats the previ-
  417.      ous reference.  Thus `!?foo?^ !$' gives the first and last
  418.      arguments from the command matching `?foo?'.
  419.  
  420.      A special abbreviation of a history reference occurs when
  421.      the first non-blank character of an input line is a `^'.
  422.      This is equivalent to `!:s^' providing a convenient short-
  423.      hand for substitutions on the text of the previous line.
  424.      Thus `^lb^lib' fixes the spelling of `lib' in the previous
  425.      command.  Finally, a history substitution may be surrounded
  426.      with `{' and `}' if necessary to insulate it from the char-
  427.      acters which follow.  Thus, after `ls -ld ~paul' we might do
  428.      `!{l}a' to do `ls -ld ~paula', while `!la' would look for a
  429.      command starting `la'.
  430.  
  431.      QQuuoottaattiioonnss wwiitthh '' aanndd ""
  432.  
  433.      The quotation of strings by `'' and `"' can be used to
  434.      prevent all or some of the remaining substitutions.  Strings
  435.      enclosed in `'' are prevented any further interpretation.
  436.      Strings enclosed in `"' may be expanded as described below.
  437.  
  438.      In both cases the resulting text becomes (all or part of) a
  439.      single word; only in one special case (see _C_o_m_m_a_n_d _S_u_b_s_t_i_t_i_-
  440.      _t_i_o_n below) does a `"' quoted string yield parts of more
  441.      than one word; `'' quoted strings never do.
  442.  
  443.      AAlliiaass ssuubbssttiittuuttiioonn
  444.  
  445.      The shell maintains a list of aliases which can be esta-
  446.      blished, displayed and modified by the _a_l_i_a_s and _u_n_a_l_i_a_s
  447.      commands.  After a command line is scanned, it is parsed
  448.      into distinct commands and the first word of each command,
  449.      left-to-right, is checked to see if it has an alias.  If it
  450.      does, then the text which is the alias for that command is
  451.      reread with the history mechanism available as though that
  452.      command were the previous input line.  The resulting words
  453.      replace the command and argument list.  If no reference is
  454.      made to the history list, then the argument list is left
  455.      unchanged.
  456.  
  457.  
  458.  
  459. Sprite v1.0              April 24, 1988                         7
  460.  
  461.  
  462.  
  463.  
  464.  
  465.  
  466. CSH                       User Commands                       CSH
  467.  
  468.  
  469.  
  470.      Thus if the alias for `ls' is `ls -l' the command `ls /usr'
  471.      would map to `ls -l /usr', the argument list here being
  472.      undisturbed.  Similarly if the alias for `lookup' was `grep
  473.      !^ /etc/passwd' then `lookup bill' would map to `grep bill
  474.      /etc/passwd'.
  475.  
  476.      If an alias is found, the word transformation of the input
  477.      text is performed and the aliasing process begins again on
  478.      the reformed input line.  Looping is prevented if the first
  479.      word of the new text is the same as the old by flagging it
  480.      to prevent further aliasing.  Other loops are detected and
  481.      cause an error.
  482.  
  483.      Note that the mechanism allows aliases to introduce parser
  484.      metasyntax.  Thus we can `alias print 'pr \!* | lpr'' to
  485.      make a command which _p_r'_s its arguments to the line printer.
  486.  
  487.      VVaarriiaabbllee ssuubbssttiittuuttiioonn
  488.  
  489.      The shell maintains a set of variables, each of which has as
  490.      value a list of zero or more words.  Some of these variables
  491.      are set by the shell or referred to by it.  For instance,
  492.      the _a_r_g_v variable is an image of the shell's argument list,
  493.      and words of this variable's value are referred to in spe-
  494.      cial ways.
  495.  
  496.      The values of variables may be displayed and changed by
  497.      using the _s_e_t and _u_n_s_e_t commands.  Of the variables referred
  498.      to by the shell a number are toggles; the shell does not
  499.      care what their value is, only whether they are set or not.
  500.      For instance, the _v_e_r_b_o_s_e variable is a toggle which causes
  501.      command input to be echoed.  The setting of this variable
  502.      results from the --vv command line option.
  503.  
  504.      Other operations treat variables numerically.  The `@' com-
  505.      mand permits numeric calculations to be performed and the
  506.      result assigned to a variable.  Variable values are, how-
  507.      ever, always represented as (zero or more) strings.  For the
  508.      purposes of numeric operations, the null string is con-
  509.      sidered to be zero, and the second and subsequent words of
  510.      multiword values are ignored.
  511.  
  512.      After the input line is aliased and parsed, and before each
  513.      command is executed, variable substitution is performed
  514.      keyed by `$' characters.  This expansion can be prevented by
  515.      preceding the `$' with a `\' except within `"'s where it
  516.      aallwwaayyss occurs, and within `''s where it nneevveerr occurs.
  517.      Strings quoted by ``' are interpreted later (see _C_o_m_m_a_n_d
  518.      _s_u_b_s_t_i_t_u_t_i_o_n below) so `$' substitution does not occur there
  519.      until later, if at all.  A `$' is passed unchanged if fol-
  520.      lowed by a blank, tab, or end-of-line.
  521.  
  522.  
  523.  
  524.  
  525. Sprite v1.0              April 24, 1988                         8
  526.  
  527.  
  528.  
  529.  
  530.  
  531.  
  532. CSH                       User Commands                       CSH
  533.  
  534.  
  535.  
  536.      Input/output redirections are recognized before variable
  537.      expansion, and are variable expanded separately.  Otherwise,
  538.      the command name and entire argument list are expanded
  539.      together.  It is thus possible for the first (command) word
  540.      to this point to generate more than one word, the first of
  541.      which becomes the command name, and the rest of which become
  542.      arguments.
  543.  
  544.      Unless enclosed in `"' or given the `:q' modifier the
  545.      results of variable substitution may eventually be command
  546.      and filename substituted.  Within `"', a variable whose
  547.      value consists of multiple words expands to a (portion of) a
  548.      single word, with the words of the variables value separated
  549.      by blanks.  When the `:q' modifier is applied to a substitu-
  550.      tion the variable will expand to multiple words with each
  551.      word separated by a blank and quoted to prevent later com-
  552.      mand or filename substitution.
  553.  
  554.      The following metasequences are provided for introducing
  555.      variable values into the shell input.  Except as noted, it
  556.      is an error to reference a variable which is not set.
  557.  
  558.      $name
  559.      ${name}
  560.           Are replaced by the words of the value of variable
  561.           _n_a_m_e, each separated by a blank.  Braces insulate _n_a_m_e
  562.           from following characters which would otherwise be part
  563.           of it.  Shell variables have names consisting of up to
  564.           20 letters and digits starting with a letter.  The
  565.           underscore character is considered a letter.
  566.           If _n_a_m_e is not a shell variable, but is set in the
  567.           environment, then that value is returned (but :: modif-
  568.           iers and the other forms given below are not available
  569.           in this case).
  570.  
  571.      $name[selector]
  572.      ${name[selector]}
  573.           May be used to select only some of the words from the
  574.           value of _n_a_m_e. The selector is subjected to `$' substi-
  575.           tution and may consist of a single number or two
  576.           numbers separated by a `-'.  The first word of a vari-
  577.           ables value is numbered `1'.  If the first number of a
  578.           range is omitted it defaults to `1'.  If the last
  579.           member of a range is omitted it defaults to `$#name'.
  580.           The selector `*' selects all words.  It is not an error
  581.           for a range to be empty if the second argument is omit-
  582.           ted or in range.
  583.  
  584.      $#name
  585.      ${#name}
  586.           Gives the number of words in the variable.  This is
  587.           useful for later use in a `[selector]'.
  588.  
  589.  
  590.  
  591. Sprite v1.0              April 24, 1988                         9
  592.  
  593.  
  594.  
  595.  
  596.  
  597.  
  598. CSH                       User Commands                       CSH
  599.  
  600.  
  601.  
  602.      $0
  603.           Substitutes the name of the file from which command
  604.           input is being read.  An error occurs if the name is
  605.           not known.
  606.  
  607.      $number
  608.      ${number}
  609.           Equivalent to `$argv[number]'.
  610.  
  611.      $*
  612.           Equivalent to `$argv[*]'.
  613.  
  614.      The modifiers `:e', `:h', `:t', `:r', `:q' and `:x' may be
  615.      applied to the substitutions above as may `:gh', `:gt' and
  616.      `:gr'.  If braces `{' '}' appear in the command form then
  617.      the modifiers must appear within the braces.  TThhee ccuurrrreenntt
  618.      iimmpplleemmeennttaattiioonn aalllloowwss oonnllyy oonnee ``::'' mmooddiiffiieerr oonn eeaacchh ``$$''
  619.      eexxppaannssiioonn..
  620.  
  621.      The following substitutions may not be modified with `:'
  622.      modifiers.
  623.  
  624.      $?name
  625.      ${?name}
  626.           Substitutes the string `1' if name is set, `0' if it is
  627.           not.
  628.  
  629.      $?0
  630.           Substitutes `1' if the current input filename is known,
  631.           `0' if it is not.
  632.  
  633.      $$
  634.           Substitute the (decimal) process number of the (parent)
  635.           shell.
  636.  
  637.      $<
  638.           Substitutes a line from the standard input, with no
  639.           further interpretation thereafter.  It can be used to
  640.           read from the keyboard in a shell script.
  641.  
  642.      CCoommmmaanndd aanndd ffiilleennaammee ssuubbssttiittuuttiioonn
  643.  
  644.      The remaining substitutions, command and filename substitu-
  645.      tion, are applied selectively to the arguments of builtin
  646.      commands.  This means that portions of expressions which are
  647.      not evaluated are not subjected to these expansions.  For
  648.      commands which are not internal to the shell, the command
  649.      name is substituted separately from the argument list.  This
  650.      occurs very late, after input-output redirection is per-
  651.      formed, and in a child of the main shell.
  652.  
  653.  
  654.  
  655.  
  656.  
  657. Sprite v1.0              April 24, 1988                        10
  658.  
  659.  
  660.  
  661.  
  662.  
  663.  
  664. CSH                       User Commands                       CSH
  665.  
  666.  
  667.  
  668.      CCoommmmaanndd ssuubbssttiittuuttiioonn
  669.  
  670.      Command substitution is indicated by a command enclosed in
  671.      ``'.  The output from such a command is normally broken into
  672.      separate words at blanks, tabs and newlines, with null words
  673.      being discarded, this text then replacing the original
  674.      string.  Within `"'s, only newlines force new words; blanks
  675.      and tabs are preserved.
  676.  
  677.      In any case, the single final newline does not force a new
  678.      word.  Note that it is thus possible for a command substitu-
  679.      tion to yield only part of a word, even if the command out-
  680.      puts a complete line.
  681.  
  682.      FFiilleennaammee ssuubbssttiittuuttiioonn
  683.  
  684.      If a word contains any of the characters `*', `?', `[' or
  685.      `{' or begins with the character `~', then that word is a
  686.      candidate for filename substitution, also known as `glob-
  687.      bing'.  This word is then regarded as a pattern, and
  688.      replaced with an alphabetically sorted list of file names
  689.      which match the pattern.  In a list of words specifying
  690.      filename substitution it is an error for no pattern to match
  691.      an existing file name, but it is not required for each pat-
  692.      tern to match.  Only the metacharacters `*', `?' and `['
  693.      imply pattern matching, the characters `~' and `{' being
  694.      more akin to abbreviations.
  695.  
  696.      In matching filenames, the character `.' at the beginning of
  697.      a filename or immediately following a `/', as well as the
  698.      character `/' must be matched explicitly.  The character `*'
  699.      matches any string of characters, including the null string.
  700.      The character `?' matches any single character.  The
  701.      sequence `[...]' matches any one of the characters enclosed.
  702.      Within `[...]', a pair of characters separated by `-'
  703.      matches any character lexically between the two.
  704.  
  705.      The character `~' at the beginning of a filename is used to
  706.      refer to home directories.  Standing alone, i.e. `~' it
  707.      expands to the invokers home directory as reflected in the
  708.      value of the variable _h_o_m_e. When followed by a name consist-
  709.      ing of letters, digits and `-' characters the shell searches
  710.      for a user with that name and substitutes their home direc-
  711.      tory;  thus `~ken' might expand to `/usr/ken' and
  712.      `~ken/chmach' to `/usr/ken/chmach'.  If the character `~' is
  713.      followed by a character other than a letter or `/' or
  714.      appears not at the beginning of a word, it is left undis-
  715.      turbed.
  716.  
  717.      The metanotation `a{b,c,d}e' is a shorthand for `abe ace
  718.      ade'.  Left to right order is preserved, with results of
  719.      matches being sorted separately at a low level to preserve
  720.  
  721.  
  722.  
  723. Sprite v1.0              April 24, 1988                        11
  724.  
  725.  
  726.  
  727.  
  728.  
  729.  
  730. CSH                       User Commands                       CSH
  731.  
  732.  
  733.  
  734.      this order.  This construct may be nested.  Thus
  735.      `~source/s1/{oldls,ls}.c' expands to `/usr/source/s1/oldls.c
  736.      /usr/source/s1/ls.c' whether or not these files exist
  737.      without any chance of error if the home directory for
  738.      `source' is `/usr/source'.  Similarly `../{memo,*box}' might
  739.      expand to `../memo ../box ../mbox'.  (Note that `memo' was
  740.      not sorted with the results of matching `*box'.) As a spe-
  741.      cial case `{', `}' and `{}' are passed undisturbed.
  742.  
  743.      IInnppuutt//oouuttppuutt
  744.  
  745.      The standard input and standard output of a command may be
  746.      redirected with the following syntax:
  747.  
  748.      < name
  749.           Open file _n_a_m_e (which is first variable, command and
  750.           filename expanded) as the standard input.
  751.  
  752.      << word
  753.           Read the shell input up to a line which is identical to
  754.           _w_o_r_d. _W_o_r_d is not subjected to variable, filename or
  755.           command substitution, and each input line is compared
  756.           to _w_o_r_d before any substitutions are done on this input
  757.           line.  Unless a quoting `\', `"', `'' or ``' appears in
  758.           _w_o_r_d variable and command substitution is performed on
  759.           the intervening lines, allowing `\' to quote `$', `\'
  760.           and ``'.  Commands which are substituted have all
  761.           blanks, tabs, and newlines preserved, except for the
  762.           final newline which is dropped.  The resultant text is
  763.           placed in an anonymous temporary file which is given to
  764.           the command as standard input.
  765.  
  766.      > name
  767.      >! name
  768.      >& name
  769.      >&! name
  770.           The file _n_a_m_e is used as standard output.  If the file
  771.           does not exist then it is created; if the file exists,
  772.           its is truncated, its previous contents being lost.
  773.  
  774.           If the variable _n_o_c_l_o_b_b_e_r is set, then the file must
  775.           not exist or be a character special file (e.g. a termi-
  776.           nal or `/dev/null') or an error results.  This helps
  777.           prevent accidental destruction of files.  In this case
  778.           the `!' forms can be used and suppress this check.
  779.  
  780.           The forms involving `&' route the diagnostic output
  781.           into the specified file as well as the standard output.
  782.           _N_a_m_e is expanded in the same way as `<' input filenames
  783.           are.
  784.  
  785.      >> name
  786.  
  787.  
  788.  
  789. Sprite v1.0              April 24, 1988                        12
  790.  
  791.  
  792.  
  793.  
  794.  
  795.  
  796. CSH                       User Commands                       CSH
  797.  
  798.  
  799.  
  800.      >>& name
  801.      >>! name
  802.      >>&! name
  803.           Uses file _n_a_m_e as standard output like `>' but places
  804.           output at the end of the file.  If the variable
  805.           _n_o_c_l_o_b_b_e_r is set, then it is an error for the file not
  806.           to exist unless one of the `!' forms is given.  Other-
  807.           wise similar to `>'.
  808.  
  809.      A command receives the environment in which the shell was
  810.      invoked as modified by the input-output parameters and the
  811.      presence of the command in a pipeline.  Thus, unlike some
  812.      previous shells, commands run from a file of shell commands
  813.      have no access to the text of the commands by default;
  814.      rather they receive the original standard input of the
  815.      shell.  The `<<' mechanism should be used to present inline
  816.      data.  This permits shell command scripts to function as
  817.      components of pipelines and allows the shell to block read
  818.      its input.  Note that the default standard input for a com-
  819.      mand run detached is nnoott modified to be the empty file
  820.      `/dev/null'; rather the standard input remains as the origi-
  821.      nal standard input of the shell.  If this is a terminal and
  822.      if the process attempts to read from the terminal, then the
  823.      process will block and the user will be notified (see JJoobbss
  824.      above).
  825.  
  826.      Diagnostic output may be directed through a pipe with the
  827.      standard output.  Simply use the form `|&' rather than just
  828.      `|'.
  829.  
  830.      EExxpprreessssiioonnss
  831.  
  832.      A number of the builtin commands (to be described subse-
  833.      quently) take expressions, in which the operators are simi-
  834.      lar to those of C, with the same precedence.  These expres-
  835.      sions appear in the @, _e_x_i_t, _i_f, and _w_h_i_l_e commands.  The
  836.      following operators are available:
  837.  
  838.           ||  &&  |  ^  &  ==  !=  =~  !~  <=  >=  <  >  <<  >>
  839.      +  -  *  /  %  !  ~  (  )
  840.  
  841.      Here the precedence increases to the right, `==' `!=' `=~'
  842.      and `!~', `<=' `>=' `<' and `>', `<<' and `>>', `+' and `-',
  843.      `*' `/' and `%' being, in groups, at the same level.  The
  844.      `==' `!=' `=~' and `!~' operators compare their arguments as
  845.      strings; all others operate on numbers.  The operators `=~'
  846.      and `!~' are like `!=' and `==' except that the right hand
  847.      side is a _p_a_t_t_e_r_n (containing, e.g. `*'s, `?'s and instances
  848.      of `[...]') against which the left hand operand is matched.
  849.      This reduces the need for use of the _s_w_i_t_c_h statement in
  850.      shell scripts when all that is really needed is pattern
  851.      matching.
  852.  
  853.  
  854.  
  855. Sprite v1.0              April 24, 1988                        13
  856.  
  857.  
  858.  
  859.  
  860.  
  861.  
  862. CSH                       User Commands                       CSH
  863.  
  864.  
  865.  
  866.      Strings which begin with `0' are considered octal numbers.
  867.      Null or missing arguments are considered `0'.  The result of
  868.      all expressions are strings, which represent decimal
  869.      numbers.  It is important to note that no two components of
  870.      an expression can appear in the same word; except when adja-
  871.      cent to components of expressions which are syntactically
  872.      significant to the parser (`&' `|' `<' `>' `(' `)') they
  873.      should be surrounded by spaces.
  874.  
  875.      Also available in expressions as primitive operands are com-
  876.      mand executions enclosed in `{' and `}' and file enquiries
  877.      of the form `-_l  name' where _l is one of:
  878.  
  879.           r    read access
  880.           w    write access
  881.           x    execute access
  882.           e    existence
  883.           o    ownership
  884.           z    zero size
  885.           f    plain file
  886.           d    directory
  887.  
  888.      The specified name is command and filename expanded and then
  889.      tested to see if it has the specified relationship to the
  890.      real user.  If the file does not exist or is inaccessible
  891.      then all enquiries return false, i.e. `0'.  Command execu-
  892.      tions succeed, returning true, i.e. `1', if the command
  893.      exits with status 0, otherwise they fail, returning false,
  894.      i.e. `0'.  If more detailed status information is required
  895.      then the command should be executed outside of an expression
  896.      and the variable _s_t_a_t_u_s examined.
  897.  
  898.      CCoonnttrrooll ffllooww
  899.  
  900.      The shell contains a number of commands which can be used to
  901.      regulate the flow of control in command files (shell
  902.      scripts) and (in limited but useful ways) from terminal
  903.      input.  These commands all operate by forcing the shell to
  904.      reread or skip in its input and, due to the implementation,
  905.      restrict the placement of some of the commands.
  906.  
  907.      The _f_o_r_e_a_c_h, _s_w_i_t_c_h, and _w_h_i_l_e statements, as well as the
  908.      _i_f-_t_h_e_n-_e_l_s_e form of the _i_f statement require that the major
  909.      keywords appear in a single simple command on an input line
  910.      as shown below.
  911.  
  912.      If the shell's input is not seekable, the shell buffers up
  913.      input whenever a loop is being read and performs seeks in
  914.      this internal buffer to accomplish the rereading implied by
  915.      the loop.  (To the extent that this allows, backward goto's
  916.      will succeed on non-seekable inputs.)
  917.  
  918.  
  919.  
  920.  
  921. Sprite v1.0              April 24, 1988                        14
  922.  
  923.  
  924.  
  925.  
  926.  
  927.  
  928. CSH                       User Commands                       CSH
  929.  
  930.  
  931.  
  932.      BBuuiillttiinn ccoommmmaannddss
  933.  
  934.      Builtin commands are executed within the shell.  If a buil-
  935.      tin command occurs as any component of a pipeline except the
  936.      last then it is executed in a subshell.
  937.  
  938.      aalliiaass
  939.      aalliiaass name
  940.      aalliiaass name wordlist
  941.           The first form prints all aliases.  The second form
  942.           prints the alias for name.  The final form assigns the
  943.           specified _w_o_r_d_l_i_s_t as the alias of _n_a_m_e; _w_o_r_d_l_i_s_t is
  944.           command and filename substituted.  _N_a_m_e is not allowed
  945.           to be _a_l_i_a_s or _u_n_a_l_i_a_s.
  946.  
  947.      aalllloocc
  948.           Shows the amount of dynamic memory acquired, broken
  949.           down into used and free memory.  With an argument shows
  950.           the number of free and used blocks in each size
  951.           category.  The categories start at size 8 and double at
  952.           each step.  This command's output may vary across sys-
  953.           tem types, since systems other than the VAX may use a
  954.           different memory allocator.
  955.  
  956.      bbgg
  957.      bbgg %%job ...
  958.           Puts the current or specified jobs into the background,
  959.           continuing them if they were stopped.
  960.  
  961.      bbrreeaakk
  962.           Causes execution to resume after the _e_n_d of the nearest
  963.           enclosing _f_o_r_e_a_c_h or _w_h_i_l_e. The remaining commands on
  964.           the current line are executed.  Multi-level breaks are
  965.           thus possible by writing them all on one line.
  966.  
  967.      bbrreeaakkssww
  968.           Causes a break from a _s_w_i_t_c_h, resuming after the _e_n_d_s_w.
  969.  
  970.      ccaassee label:
  971.           A label in a _s_w_i_t_c_h statement as discussed below.
  972.  
  973.      ccdd
  974.      ccdd name
  975.      cchhddiirr
  976.      cchhddiirr name
  977.           Change the shell's working directory to directory _n_a_m_e.
  978.           If no argument is given then change to the home direc-
  979.           tory of the user.
  980.           If _n_a_m_e is not found as a subdirectory of the current
  981.           directory (and does not begin with `/', `./' or `../'),
  982.           then each component of the variable _c_d_p_a_t_h is checked
  983.           to see if it has a subdirectory _n_a_m_e. Finally, if all
  984.  
  985.  
  986.  
  987. Sprite v1.0              April 24, 1988                        15
  988.  
  989.  
  990.  
  991.  
  992.  
  993.  
  994. CSH                       User Commands                       CSH
  995.  
  996.  
  997.  
  998.           else fails but _n_a_m_e is a shell variable whose value
  999.           begins with `/', then this is tried to see if it is a
  1000.           directory.
  1001.  
  1002.      ccoonnttiinnuuee
  1003.           Continue execution of the nearest enclosing _w_h_i_l_e or
  1004.           _f_o_r_e_a_c_h. The rest of the commands on the current line
  1005.           are executed.
  1006.  
  1007.      ddeeffaauulltt::
  1008.           Labels the default case in a _s_w_i_t_c_h statement.  The
  1009.           default should come after all _c_a_s_e labels.
  1010.  
  1011.      ddiirrss
  1012.           Prints the directory stack; the top of the stack is at
  1013.           the left, the first directory in the stack being the
  1014.           current directory.
  1015.  
  1016.      eecchhoo wordlist
  1017.      eecchhoo --nn wordlist
  1018.           The specified words are written to the shells standard
  1019.           output, separated by spaces, and terminated with a new-
  1020.           line unless the --nn option is specified.
  1021.  
  1022.      eellssee
  1023.      eenndd
  1024.      eennddiiff
  1025.      eennddssww
  1026.           See the description of the _f_o_r_e_a_c_h, _i_f, _s_w_i_t_c_h, and
  1027.           _w_h_i_l_e statements below.
  1028.  
  1029.      eevvaall arg ...
  1030.           (As in _s_h(1).) The arguments are read as input to the
  1031.           shell and the resulting command(s) executed in the con-
  1032.           text of the current shell.  This is usually used to
  1033.           execute commands generated as the result of command or
  1034.           variable substitution, since parsing occurs before
  1035.           these substitutions.  See _t_s_e_t(1) for an example of
  1036.           using _e_v_a_l.
  1037.  
  1038.      eexxeecc command
  1039.           The specified command is executed in place of the
  1040.           current shell.
  1041.  
  1042.      eexxiitt
  1043.      eexxiitt(expr)
  1044.           The shell exits either with the value of the _s_t_a_t_u_s
  1045.           variable (first form) or with the value of the speci-
  1046.           fied _e_x_p_r (second form).
  1047.  
  1048.      ffgg
  1049.      ffgg %%job ...
  1050.  
  1051.  
  1052.  
  1053. Sprite v1.0              April 24, 1988                        16
  1054.  
  1055.  
  1056.  
  1057.  
  1058.  
  1059.  
  1060. CSH                       User Commands                       CSH
  1061.  
  1062.  
  1063.  
  1064.           Brings the current or specified jobs into the fore-
  1065.           ground, continuing them if they were stopped.
  1066.  
  1067.      ffoorreeaacchh name (wordlist)
  1068.          ...
  1069.      eenndd
  1070.           The variable _n_a_m_e is successively set to each member of
  1071.           _w_o_r_d_l_i_s_t and the sequence of commands between this com-
  1072.           mand and the matching _e_n_d are executed.  (Both _f_o_r_e_a_c_h
  1073.           and _e_n_d must appear alone on separate lines.)
  1074.  
  1075.           The builtin command _c_o_n_t_i_n_u_e may be used to continue
  1076.           the loop prematurely and the builtin command _b_r_e_a_k to
  1077.           terminate it prematurely.  When this command is read
  1078.           from the terminal, the loop is read up once prompting
  1079.           with `?' before any statements in the loop are exe-
  1080.           cuted.  If you make a mistake typing in a loop at the
  1081.           terminal you can rub it out.
  1082.  
  1083.      gglloobb wordlist
  1084.           Like _e_c_h_o but no `\' escapes are recognized and words
  1085.           are delimited by null characters in the output.  Useful
  1086.           for programs which wish to use the shell to filename
  1087.           expand a list of words.
  1088.  
  1089.      ggoottoo word
  1090.           The specified _w_o_r_d is filename and command expanded to
  1091.           yield a string of the form `label'.  The shell rewinds
  1092.           its input as much as possible and searches for a line
  1093.           of the form `label:' possibly preceded by blanks or
  1094.           tabs.  Execution continues after the specified line.
  1095.  
  1096.      hhaasshhssttaatt
  1097.           Print a statistics line indicating how effective the
  1098.           internal hash table has been at locating commands (and
  1099.           avoiding _e_x_e_c's).  An _e_x_e_c is attempted for each com-
  1100.           ponent of the _p_a_t_h where the hash function indicates a
  1101.           possible hit, and in each component which does not
  1102.           begin with a `/'.
  1103.  
  1104.      hhiissttoorryy
  1105.      hhiissttoorryy _n
  1106.      hhiissttoorryy --rr _n
  1107.      hhiissttoorryy --hh _n
  1108.           Displays the history event list; if _n is given only the
  1109.           _n most recent events are printed.  The --rr option rev-
  1110.           erses the order of printout to be most recent first
  1111.           rather than oldest first.  The --hh option causes the
  1112.           history list to be printed without leading numbers.
  1113.           This is used to produce files suitable for sourceing
  1114.           using the -h option to _s_o_u_r_c_e.
  1115.  
  1116.  
  1117.  
  1118.  
  1119. Sprite v1.0              April 24, 1988                        17
  1120.  
  1121.  
  1122.  
  1123.  
  1124.  
  1125.  
  1126. CSH                       User Commands                       CSH
  1127.  
  1128.  
  1129.  
  1130.      iiff (expr) command
  1131.           If the specified expression evaluates true, then the
  1132.           single _c_o_m_m_a_n_d with arguments is executed.  Variable
  1133.           substitution on _c_o_m_m_a_n_d happens early, at the same time
  1134.           it does for the rest of the _i_f command.  _C_o_m_m_a_n_d must
  1135.           be a simple command, not a pipeline, a command list, or
  1136.           a parenthesized command list.  Input/output redirection
  1137.           occurs even if _e_x_p_r is false, when command is nnoott exe-
  1138.           cuted (this is a bug).
  1139.  
  1140.      iiff (expr) tthheenn
  1141.          ...
  1142.      eellssee iiff (expr2) tthheenn
  1143.          ...
  1144.      eellssee
  1145.          ...
  1146.      eennddiiff
  1147.           If the specified _e_x_p_r is true then the commands to the
  1148.           first _e_l_s_e are executed; otherwise if _e_x_p_r_2 is true
  1149.           then the commands to the second _e_l_s_e are executed, etc.
  1150.           Any number of _e_l_s_e-_i_f pairs are possible; only one
  1151.           _e_n_d_i_f is needed.  The _e_l_s_e part is likewise optional.
  1152.           (The words _e_l_s_e and _e_n_d_i_f must appear at the beginning
  1153.           of input lines; the _i_f must appear alone on its input
  1154.           line or after an _e_l_s_e.)
  1155.  
  1156.      jjoobbss
  1157.      jjoobbss --ll
  1158.           Lists the active jobs; given the --ll options lists pro-
  1159.           cess id's in addition to the normal information.
  1160.  
  1161.      kkiillll %%job
  1162.      kkiillll --sig %%job ...
  1163.      kkiillll pid
  1164.      kkiillll --sig pid ...
  1165.      kkiillll --ll
  1166.           Sends either the TERM (terminate) signal or the speci-
  1167.           fied signal to the specified jobs or processes.  Sig-
  1168.           nals are either given by number or by names (as given
  1169.           in /_u_s_r/_i_n_c_l_u_d_e/_s_i_g_n_a_l._h, stripped of the prefix
  1170.           ``SIG'').  The signal names are listed by ``kill -l''.
  1171.           There is no default, saying just `kill' does not send a
  1172.           signal to the current job.  If the signal being sent is
  1173.           TERM (terminate) or HUP (hangup), then the job or pro-
  1174.           cess will be sent a CONT (continue) signal as well.
  1175.  
  1176.      lliimmiitt
  1177.      lliimmiitt _r_e_s_o_u_r_c_e
  1178.      lliimmiitt _r_e_s_o_u_r_c_e _m_a_x_i_m_u_m-_u_s_e
  1179.      lliimmiitt --hh
  1180.      lliimmiitt --hh _r_e_s_o_u_r_c_e
  1181.      lliimmiitt --hh _r_e_s_o_u_r_c_e _m_a_x_i_m_u_m-_u_s_e
  1182.  
  1183.  
  1184.  
  1185. Sprite v1.0              April 24, 1988                        18
  1186.  
  1187.  
  1188.  
  1189.  
  1190.  
  1191.  
  1192. CSH                       User Commands                       CSH
  1193.  
  1194.  
  1195.  
  1196.           Limits the consumption by the current process and each
  1197.           process it creates to not individually exceed _m_a_x_i_m_u_m-
  1198.           _u_s_e on the specified _r_e_s_o_u_r_c_e.  If no _m_a_x_i_m_u_m-_u_s_e is
  1199.           given, then the current limit is printed; if no
  1200.           _r_e_s_o_u_r_c_e is given, then all limitations are given.  If
  1201.           the --hh flag is given, the hard limits are used instead
  1202.           of the current limits.  The hard limits impose a ceil-
  1203.           ing on the values of the current limits.  Only the
  1204.           super-user may raise the hard limits, but a user may
  1205.           lower or raise the current limits within the legal
  1206.           range.
  1207.  
  1208.           Resources controllable currently include _c_p_u_t_i_m_e (the
  1209.           maximum number of cpu-seconds to be used by each pro-
  1210.           cess), _f_i_l_e_s_i_z_e (the largest single file which can be
  1211.           created), _d_a_t_a_s_i_z_e (the maximum growth of the
  1212.           data+stack region via _s_b_r_k(2) beyond the end of the
  1213.           program text), _s_t_a_c_k_s_i_z_e (the maximum size of the
  1214.           automatically-extended stack region), and _c_o_r_e_d_u_m_p_s_i_z_e
  1215.           (the size of the largest core dump that will be
  1216.           created).
  1217.  
  1218.           The _m_a_x_i_m_u_m-_u_s_e may be given as a (floating point or
  1219.           integer) number followed by a scale factor.  For all
  1220.           limits other than _c_p_u_t_i_m_e the default scale is `k' or
  1221.           `kilobytes' (1024 bytes); a scale factor of `m' or
  1222.           `megabytes' may also be used.  For _c_p_u_t_i_m_e the default
  1223.           scaling is `seconds', while `m' for minutes or `h' for
  1224.           hours, or a time of the form `mm:ss' giving minutes and
  1225.           seconds may be used.
  1226.  
  1227.           For both _r_e_s_o_u_r_c_e names and scale factors, unambiguous
  1228.           prefixes of the names suffice.
  1229.  
  1230.      llooggiinn
  1231.           Terminate a login shell, replacing it with an instance
  1232.           of //bbiinn//llooggiinn.. This is one way to log off, included for
  1233.           compatibility with _s_h(1).
  1234.  
  1235.      llooggoouutt
  1236.           Terminate a login shell.  Especially useful if
  1237.           _i_g_n_o_r_e_e_o_f is set.
  1238.  
  1239.      nniiccee
  1240.      nniiccee +number
  1241.      nniiccee command
  1242.      nniiccee +number command
  1243.           The first form sets the scheduling priority for this
  1244.           shell to 4.  The second form sets the priority to the
  1245.           given number.  The final two forms run command at
  1246.           priority 4 and _n_u_m_b_e_r respectively.  The greater the
  1247.           number, the less cpu the process will get.  The super-
  1248.  
  1249.  
  1250.  
  1251. Sprite v1.0              April 24, 1988                        19
  1252.  
  1253.  
  1254.  
  1255.  
  1256.  
  1257.  
  1258. CSH                       User Commands                       CSH
  1259.  
  1260.  
  1261.  
  1262.           user may specify negative priority by using `nice
  1263.           -number ...'.  Command is always executed in a sub-
  1264.           shell, and the restrictions placed on commands in sim-
  1265.           ple _i_f statements apply.
  1266.  
  1267.      nnoohhuupp
  1268.      nnoohhuupp command
  1269.           The first form can be used in shell scripts to cause
  1270.           hangups to be ignored for the remainder of the script.
  1271.           The second form causes the specified command to be run
  1272.           with hangups ignored.  All processes detached with `&'
  1273.           are effectively _n_o_h_u_p'_e_d.
  1274.  
  1275.      nnoottiiffyy
  1276.      nnoottiiffyy %%job ...
  1277.           Causes the shell to notify the user asynchronously when
  1278.           the status of the current or specified jobs changes;
  1279.           normally notification is presented before a prompt.
  1280.           This is automatic if the shell variable _n_o_t_i_f_y is set.
  1281.  
  1282.      oonniinnttrr
  1283.      oonniinnttrr  -
  1284.      oonniinnttrr  label
  1285.           Control the action of the shell on interrupts.  The
  1286.           first form restores the default action of the shell on
  1287.           interrupts which is to terminate shell scripts or to
  1288.           return to the terminal command input level.  The second
  1289.           form `onintr -' causes all interrupts to be ignored.
  1290.           The final form causes the shell to execute a `goto
  1291.           label' when an interrupt is received or a child process
  1292.           terminates because it was interrupted.
  1293.  
  1294.           In any case, if the shell is running detached and
  1295.           interrupts are being ignored, all forms of _o_n_i_n_t_r have
  1296.           no meaning and interrupts continue to be ignored by the
  1297.           shell and all invoked commands.
  1298.  
  1299.      ppooppdd
  1300.      ppooppdd +n
  1301.           Pops the directory stack, returning to the new top
  1302.           directory.  With an argument `+_n' discards the _nth
  1303.           entry in the stack.  The elements of the directory
  1304.           stack are numbered from 0 starting at the top.
  1305.  
  1306.      ppuusshhdd
  1307.      ppuusshhdd name
  1308.      ppuusshhdd +n
  1309.           With no arguments, _p_u_s_h_d exchanges the top two elements
  1310.           of the directory stack.  Given a _n_a_m_e argument, _p_u_s_h_d
  1311.           changes to the new directory (ala _c_d) and pushes the
  1312.           old current working directory (as in _c_s_w) onto the
  1313.           directory stack.  With a numeric argument, rotates the
  1314.  
  1315.  
  1316.  
  1317. Sprite v1.0              April 24, 1988                        20
  1318.  
  1319.  
  1320.  
  1321.  
  1322.  
  1323.  
  1324. CSH                       User Commands                       CSH
  1325.  
  1326.  
  1327.  
  1328.           _nth argument of the directory stack around to be the
  1329.           top element and changes to it.  The members of the
  1330.           directory stack are numbered from the top starting at
  1331.           0.
  1332.  
  1333.      rreehhaasshh
  1334.           Causes the internal hash table of the contents of the
  1335.           directories in the _p_a_t_h variable to be recomputed.
  1336.           This is needed if new commands are added to directories
  1337.           in the _p_a_t_h while you are logged in.  This should only
  1338.           be necessary if you add commands to one of your own
  1339.           directories, or if a systems programmer changes the
  1340.           contents of one of the system directories.
  1341.  
  1342.      rreeppeeaatt count command
  1343.           The specified _c_o_m_m_a_n_d which is subject to the same res-
  1344.           trictions as the _c_o_m_m_a_n_d in the one line _i_f statement
  1345.           above, is executed _c_o_u_n_t times.  I/O redirections occur
  1346.           exactly once, even if _c_o_u_n_t is 0.
  1347.  
  1348.      sseett
  1349.      sseett name
  1350.      sseett name=word
  1351.      sseett name[index]=word
  1352.      sseett name=(wordlist)
  1353.           The first form of the command shows the value of all
  1354.           shell variables.  Variables which have other than a
  1355.           single word as value print as a parenthesized word
  1356.           list.  The second form sets _n_a_m_e to the null string.
  1357.           The third form sets _n_a_m_e to the single _w_o_r_d. The fourth
  1358.           form sets the _i_n_d_e_x'_t_h component of name to word; this
  1359.           component must already exist.  The final form sets _n_a_m_e
  1360.           to the list of words in _w_o_r_d_l_i_s_t. In all cases the
  1361.           value is command and filename expanded.
  1362.  
  1363.           These arguments may be repeated to set multiple values
  1364.           in a single set command.  Note however, that variable
  1365.           expansion happens for all arguments before any setting
  1366.           occurs.
  1367.  
  1368.      sseetteennvv
  1369.      sseetteennvv name value
  1370.      sseetteennvv name
  1371.           The first form lists all current environment variables.
  1372.           The last form sets the value of environment variable
  1373.           _n_a_m_e to be _v_a_l_u_e, a single string.  The second form
  1374.           sets _n_a_m_e to an empty string.  The most commonly used
  1375.           environment variable USER, TERM, and PATH are automati-
  1376.           cally imported to and exported from the _c_s_h variables
  1377.           _u_s_e_r, _t_e_r_m, and _p_a_t_h; there is no need to use _s_e_t_e_n_v
  1378.           for these.
  1379.  
  1380.  
  1381.  
  1382.  
  1383. Sprite v1.0              April 24, 1988                        21
  1384.  
  1385.  
  1386.  
  1387.  
  1388.  
  1389.  
  1390. CSH                       User Commands                       CSH
  1391.  
  1392.  
  1393.  
  1394.      sshhiifftt
  1395.      sshhiifftt variable
  1396.           The members of _a_r_g_v are shifted to the left, discarding
  1397.           _a_r_g_v[_1]. It is an error for _a_r_g_v not to be set or to
  1398.           have less than one word as value.  The second form per-
  1399.           forms the same function on the specified variable.
  1400.  
  1401.      ssoouurrccee name
  1402.      ssoouurrccee --hh name
  1403.           The shell reads commands from _n_a_m_e. _S_o_u_r_c_e commands may
  1404.           be nested; if they are nested too deeply the shell may
  1405.           run out of file descriptors.  An error in a _s_o_u_r_c_e at
  1406.           any level terminates all nested _s_o_u_r_c_e commands.  Nor-
  1407.           mally input during _s_o_u_r_c_e commands is not placed on the
  1408.           history list; the -h option causes the commands to be
  1409.           placed in the history list without being executed.
  1410.  
  1411.      ssttoopp
  1412.      ssttoopp %%job ...
  1413.           Stops the current or specified job which is executing
  1414.           in the background.
  1415.  
  1416.      ssuussppeenndd
  1417.           Causes the shell to stop in its tracks, much as if it
  1418.           had been sent a stop signal with ^^ZZ.  This is most
  1419.           often used to stop shells started by _s_u(1).
  1420.  
  1421.      sswwiittcchh (string)
  1422.      ccaassee str1:
  1423.          ...
  1424.        bbrreeaakkssww
  1425.      ...
  1426.      ddeeffaauulltt::
  1427.          ...
  1428.        bbrreeaakkssww
  1429.      eennddssww
  1430.           Each case label is successively matched, against the
  1431.           specified _s_t_r_i_n_g which is first command and filename
  1432.           expanded.  The file metacharacters `*', `?' and `[...]'
  1433.           may be used in the case labels, which are variable
  1434.           expanded.  If none of the labels match before a
  1435.           `default' label is found, then the execution begins
  1436.           after the default label.  Each case label and the
  1437.           default label must appear at the beginning of a line.
  1438.           The command _b_r_e_a_k_s_w causes execution to continue after
  1439.           the _e_n_d_s_w. Otherwise control may fall through case
  1440.           labels and default labels as in C.  If no label matches
  1441.           and there is no default, execution continues after the
  1442.           _e_n_d_s_w.
  1443.  
  1444.      ttiimmee
  1445.      ttiimmee command
  1446.  
  1447.  
  1448.  
  1449. Sprite v1.0              April 24, 1988                        22
  1450.  
  1451.  
  1452.  
  1453.  
  1454.  
  1455.  
  1456. CSH                       User Commands                       CSH
  1457.  
  1458.  
  1459.  
  1460.           With no argument, a summary of time used by this shell
  1461.           and its children is printed.  If arguments are given
  1462.           the specified simple command is timed and a time sum-
  1463.           mary as described under the _t_i_m_e variable is printed.
  1464.           If necessary, an extra shell is created to print the
  1465.           time statistic when the command completes.
  1466.  
  1467.      uummaasskk
  1468.      uummaasskk value
  1469.           The file creation mask is displayed (first form) or set
  1470.           to the specified value (second form).  The mask is
  1471.           given in octal.  Common values for the mask are 002
  1472.           giving all access to the group and read and execute
  1473.           access to others or 022 giving all access except no
  1474.           write access for users in the group or others.
  1475.  
  1476.      uunnaalliiaass pattern
  1477.           All aliases whose names match the specified pattern are
  1478.           discarded.  Thus all aliases are removed by `unalias
  1479.           *'.  It is not an error for nothing to be _u_n_a_l_i_a_s_e_d.
  1480.  
  1481.      uunnhhaasshh
  1482.           Use of the internal hash table to speed location of
  1483.           executed programs is disabled.
  1484.  
  1485.      uunnlliimmiitt
  1486.      uunnlliimmiitt _r_e_s_o_u_r_c_e
  1487.      uunnlliimmiitt --hh
  1488.      uunnlliimmiitt --hh _r_e_s_o_u_r_c_e
  1489.           Removes the limitation on _r_e_s_o_u_r_c_e.  If no _r_e_s_o_u_r_c_e is
  1490.           specified, then all _r_e_s_o_u_r_c_e limitations are removed.
  1491.           If --hh is given, the corresponding hard limits are
  1492.           removed.  Only the super-user may do this.
  1493.  
  1494.      uunnsseett pattern
  1495.           All variables whose names match the specified pattern
  1496.           are removed.  Thus all variables are removed by `unset
  1497.           *'; this has noticeably distasteful side-effects.  It
  1498.           is not an error for nothing to be _u_n_s_e_t.
  1499.  
  1500.      uunnsseetteennvv pattern
  1501.           Removes all variables whose name match the specified
  1502.           pattern from the environment.  See also the _s_e_t_e_n_v com-
  1503.           mand above and _p_r_i_n_t_e_n_v(1).
  1504.  
  1505.      wwaaiitt
  1506.           All background jobs are waited for.  It the shell is
  1507.           interactive, then an interrupt can disrupt the wait, at
  1508.           which time the shell prints names and job numbers of
  1509.           all jobs known to be outstanding.
  1510.  
  1511.      wwhhiillee (expr)
  1512.  
  1513.  
  1514.  
  1515. Sprite v1.0              April 24, 1988                        23
  1516.  
  1517.  
  1518.  
  1519.  
  1520.  
  1521.  
  1522. CSH                       User Commands                       CSH
  1523.  
  1524.  
  1525.  
  1526.          ...
  1527.      eenndd
  1528.           While the specified expression evaluates non-zero, the
  1529.           commands between the _w_h_i_l_e and the matching end are
  1530.           evaluated.  _B_r_e_a_k and _c_o_n_t_i_n_u_e may be used to terminate
  1531.           or continue the loop prematurely.  (The _w_h_i_l_e and _e_n_d
  1532.           must appear alone on their input lines.) Prompting
  1533.           occurs here the first time through the loop as for the
  1534.           _f_o_r_e_a_c_h statement if the input is a terminal.
  1535.  
  1536.      %%job
  1537.           Brings the specified job into the foreground.
  1538.  
  1539.      %%job &&
  1540.           Continues the specified job in the background.
  1541.  
  1542.      @@
  1543.      @@ name = expr
  1544.      @@ name[index] = expr
  1545.           The first form prints the values of all the shell vari-
  1546.           ables.  The second form sets the specified _n_a_m_e to the
  1547.           value of _e_x_p_r. If the expression contains `<', `>', `&'
  1548.           or `|' then at least this part of the expression must
  1549.           be placed within `(' `)'.  The third form assigns the
  1550.           value of _e_x_p_r to the _i_n_d_e_x'_t_h argument of _n_a_m_e. Both
  1551.           _n_a_m_e and its _i_n_d_e_x'_t_h component must already exist.
  1552.  
  1553.           The operators `*=', `+=', etc are available as in C.
  1554.           The space separating the name from the assignment
  1555.           operator is optional.  Spaces are, however, mandatory
  1556.           in separating components of _e_x_p_r which would otherwise
  1557.           be single words.
  1558.  
  1559.           Special postfix `++' and `--' operators increment and
  1560.           decrement _n_a_m_e respectively, i.e. `@  i++'.
  1561.  
  1562.      PPrree--ddeeffiinneedd aanndd eennvviirroonnmmeenntt vvaarriiaabblleess
  1563.  
  1564.      The following variables have special meaning to the shell.
  1565.      Of these, _a_r_g_v, _c_w_d, _h_o_m_e, _p_a_t_h, _p_r_o_m_p_t, _s_h_e_l_l and _s_t_a_t_u_s
  1566.      are always set by the shell.  Except for _c_w_d and _s_t_a_t_u_s this
  1567.      setting occurs only at initialization; these variables will
  1568.      not then be modified unless this is done explicitly by the
  1569.      user.
  1570.  
  1571.      This shell copies the environment variable USER into the
  1572.      variable _u_s_e_r, TERM into _t_e_r_m, and HOME into _h_o_m_e, and
  1573.      copies these back into the environment whenever the normal
  1574.      shell variables are reset.  The environment variable PATH is
  1575.      likewise handled; it is not necessary to worry about its
  1576.      setting other than in the file ._c_s_h_r_c as inferior _c_s_h
  1577.      processes will import the definition of _p_a_t_h from the
  1578.  
  1579.  
  1580.  
  1581. Sprite v1.0              April 24, 1988                        24
  1582.  
  1583.  
  1584.  
  1585.  
  1586.  
  1587.  
  1588. CSH                       User Commands                       CSH
  1589.  
  1590.  
  1591.  
  1592.      environment, and re-export it if you then change it.
  1593.  
  1594.      aarrggvv           Set to the arguments to the shell, it is from
  1595.                     this variable that positional parameters are
  1596.                     substituted, i.e. `$1' is replaced by
  1597.                     `$argv[1]', etc.
  1598.  
  1599.      ccddppaatthh         Gives a list of alternate directories
  1600.                     searched to find subdirectories in _c_h_d_i_r com-
  1601.                     mands.
  1602.  
  1603.      ccwwdd            The full pathname of the current directory.
  1604.  
  1605.      eecchhoo           Set when the --xx command line option is given.
  1606.                     Causes each command and its arguments to be
  1607.                     echoed just before it is executed.  For non-
  1608.                     builtin commands all expansions occur before
  1609.                     echoing.  Builtin commands are echoed before
  1610.                     command and filename substitution, since
  1611.                     these substitutions are then done selec-
  1612.                     tively.
  1613.  
  1614.      ffiilleecc          Enable file name completion.
  1615.  
  1616.      hhiissttcchhaarrss      Can be given a string value to change the
  1617.                     characters used in history substitution.  The
  1618.                     first character of its value is used as the
  1619.                     history substitution character, replacing the
  1620.                     default character !.  The second character of
  1621.                     its value replaces the character |^ in quick
  1622.                     substitutions.
  1623.  
  1624.      hhiissttoorryy        Can be given a numeric value to control the
  1625.                     size of the history list.  Any command which
  1626.                     has been referenced in this many events will
  1627.                     not be discarded.  Too large values of _h_i_s_-
  1628.                     _t_o_r_y may run the shell out of memory.  The
  1629.                     last executed command is always saved on the
  1630.                     history list.
  1631.  
  1632.      hhoommee           The home directory of the invoker, initial-
  1633.                     ized from the environment.  The filename
  1634.                     expansion of `~~' refers to this variable.
  1635.  
  1636.      iiggnnoorreeeeooff      If set the shell ignores end-of-file from
  1637.                     input devices which are terminals.  This
  1638.                     prevents shells from accidentally being
  1639.                     killed by control-D's.
  1640.  
  1641.      mmaaiill           The files where the shell checks for mail.
  1642.                     This is done after each command completion
  1643.                     which will result in a prompt, if a specified
  1644.  
  1645.  
  1646.  
  1647. Sprite v1.0              April 24, 1988                        25
  1648.  
  1649.  
  1650.  
  1651.  
  1652.  
  1653.  
  1654. CSH                       User Commands                       CSH
  1655.  
  1656.  
  1657.  
  1658.                     interval has elapsed.  The shell says `You
  1659.                     have new mail.' if the file exists with an
  1660.                     access time not greater than its modify time.
  1661.  
  1662.                     If the first word of the value of _m_a_i_l is
  1663.                     numeric it specifies a different mail check-
  1664.                     ing interval, in seconds, than the default,
  1665.                     which is 10 minutes.
  1666.  
  1667.                     If multiple mail files are specified, then
  1668.                     the shell says `New mail in _n_a_m_e' when there
  1669.                     is mail in the file _n_a_m_e.
  1670.  
  1671.      nnoocclloobbbbeerr      As described in the section on _I_n_p_u_t/_o_u_t_p_u_t,
  1672.                     restrictions are placed on output redirection
  1673.                     to insure that files are not accidentally
  1674.                     destroyed, and that `>>' redirections refer
  1675.                     to existing files.
  1676.  
  1677.      nnoogglloobb         If set, filename expansion is inhibited.
  1678.                     This is most useful in shell scripts which
  1679.                     are not dealing with filenames, or after a
  1680.                     list of filenames has been obtained and
  1681.                     further expansions are not desirable.
  1682.  
  1683.      nnoonnoommaattcchh      If set, it is not an error for a filename
  1684.                     expansion to not match any existing files;
  1685.                     rather the primitive pattern is returned.  It
  1686.                     is still an error for the primitive pattern
  1687.                     to be malformed, i.e.  `echo [' still gives
  1688.                     an error.
  1689.  
  1690.      nnoottiiffyy         If set, the shell notifies asynchronously of
  1691.                     job completions.  The default is to rather
  1692.                     present job completions just before printing
  1693.                     a prompt.
  1694.  
  1695.      ppaatthh           Each word of the path variable specifies a
  1696.                     directory in which commands are to be sought
  1697.                     for execution.  A null word specifies the
  1698.                     current directory.  If there is no _p_a_t_h vari-
  1699.                     able then only full path names will execute.
  1700.                     The usual search path is `.', `/bin' and
  1701.                     `/usr/bin', but this may vary from system to
  1702.                     system.  For the super-user the default
  1703.                     search path is `/etc', `/bin' and `/usr/bin'.
  1704.                     A shell which is given neither the --cc nor the
  1705.                     --tt option will normally hash the contents of
  1706.                     the directories in the _p_a_t_h variable after
  1707.                     reading ._c_s_h_r_c, and each time the _p_a_t_h vari-
  1708.                     able is reset.  If new commands are added to
  1709.                     these directories while the shell is active,
  1710.  
  1711.  
  1712.  
  1713. Sprite v1.0              April 24, 1988                        26
  1714.  
  1715.  
  1716.  
  1717.  
  1718.  
  1719.  
  1720. CSH                       User Commands                       CSH
  1721.  
  1722.  
  1723.  
  1724.                     it may be necessary to give the _r_e_h_a_s_h or the
  1725.                     commands may not be found.
  1726.  
  1727.      pprroommpptt         The string which is printed before each com-
  1728.                     mand is read from an interactive terminal
  1729.                     input.  If a `!' appears in the string it
  1730.                     will be replaced by the current event number
  1731.                     unless a preceding `\' is given.  Default is
  1732.                     `% ', or `# ' for the super-user.
  1733.  
  1734.      ssaavveehhiisstt       is given a numeric value to control the
  1735.                     number of entries of the history list that
  1736.                     are saved in ~/.history when the user logs
  1737.                     out.  Any command which has been referenced
  1738.                     in this many events will be saved.  During
  1739.                     start up the shell sources ~/.history into
  1740.                     the history list enabling history to be saved
  1741.                     across logins.  Too large values of _s_a_v_e_h_i_s_t
  1742.                     will slow down the shell during start up.
  1743.  
  1744.      sshheellll          The file in which the shell resides.  This is
  1745.                     used in forking shells to interpret files
  1746.                     which have execute bits set, but which are
  1747.                     not executable by the system.  (See the
  1748.                     description of _N_o_n-_b_u_i_l_t_i_n _C_o_m_m_a_n_d _E_x_e_c_u_t_i_o_n
  1749.                     below.) Initialized to the (system-dependent)
  1750.                     home of the shell.
  1751.  
  1752.      ssttaattuuss         The status returned by the last command.  If
  1753.                     it terminated abnormally, then 0200 is added
  1754.                     to the status.  Builtin commands which fail
  1755.                     return exit status `1', all other builtin
  1756.                     commands set status `0'.
  1757.  
  1758.      ttiimmee           Controls automatic timing of commands.  If
  1759.                     set, then any command which takes more than
  1760.                     this many cpu seconds will cause a line giv-
  1761.                     ing user, system, and real times and a utili-
  1762.                     zation percentage which is the ratio of user
  1763.                     plus system times to real time to be printed
  1764.                     when it terminates.
  1765.  
  1766.      vveerrbboossee        Set by the --vv command line option, causes the
  1767.                     words of each command to be printed after
  1768.                     history substitution.
  1769.  
  1770.      NNoonn--bbuuiillttiinn ccoommmmaanndd eexxeeccuuttiioonn
  1771.  
  1772.      When a command to be executed is found to not be a builtin
  1773.      command the shell attempts to execute the command via
  1774.      _e_x_e_c_v_e(2).  Each word in the variable _p_a_t_h names a directory
  1775.      from which the shell will attempt to execute the command.
  1776.  
  1777.  
  1778.  
  1779. Sprite v1.0              April 24, 1988                        27
  1780.  
  1781.  
  1782.  
  1783.  
  1784.  
  1785.  
  1786. CSH                       User Commands                       CSH
  1787.  
  1788.  
  1789.  
  1790.      If it is given neither a --cc nor a --tt option, the shell will
  1791.      hash the names in these directories into an internal table
  1792.      so that it will only try an _e_x_e_c in a directory if there is
  1793.      a possibility that the command resides there.  This greatly
  1794.      speeds command location when a large number of directories
  1795.      are present in the search path.  If this mechanism has been
  1796.      turned off (via _u_n_h_a_s_h), or if the shell was given a --cc or
  1797.      --tt argument, and in any case for each directory component of
  1798.      _p_a_t_h which does not begin with a `/', the shell concatenates
  1799.      with the given command name to form a path name of a file
  1800.      which it then attempts to execute.
  1801.  
  1802.      Parenthesized commands are always executed in a subshell.
  1803.      Thus `(cd ; pwd) ; pwd' prints the _h_o_m_e directory; leaving
  1804.      you where you were (printing this after the home directory),
  1805.      while `cd ; pwd' leaves you in the _h_o_m_e directory.
  1806.      Parenthesized commands are most often used to prevent _c_h_d_i_r
  1807.      from affecting the current shell.
  1808.  
  1809.      If the file has execute permissions but is not an executable
  1810.      binary to the system, then it is assumed to be a file con-
  1811.      taining shell commands and a new shell is spawned to read
  1812.      it.
  1813.  
  1814.      If there is an _a_l_i_a_s for _s_h_e_l_l then the words of the alias
  1815.      will be prepended to the argument list to form the shell
  1816.      command.  The first word of the _a_l_i_a_s should be the full
  1817.      path name of the shell (e.g. `$shell').  Note that this is a
  1818.      special, late occurring, case of _a_l_i_a_s substitution, and
  1819.      only allows words to be prepended to the argument list
  1820.      without modification.
  1821.  
  1822.      AArrgguummeenntt lliisstt pprroocceessssiinngg
  1823.  
  1824.      If argument 0 to the shell is `-' then this is a login
  1825.      shell.  The flag arguments are interpreted as follows:
  1826.  
  1827.      --bb   This flag forces a ``break'' from option processing,
  1828.           causing any further shell arguments to be treated as
  1829.           non-option arguments.  The remaining arguments will not
  1830.           be interpreted as shell options.  This may be used to
  1831.           pass options to a shell script without confusion or
  1832.           possible subterfuge.  The shell will not run a set-user
  1833.           ID script without this option.
  1834.  
  1835.      --cc   Commands are read from the (single) following argument
  1836.           which must be present.  Any remaining arguments are
  1837.           placed in _a_r_g_v.
  1838.  
  1839.      --ee   The shell exits if any invoked command terminates
  1840.           abnormally or yields a non-zero exit status.
  1841.  
  1842.  
  1843.  
  1844.  
  1845. Sprite v1.0              April 24, 1988                        28
  1846.  
  1847.  
  1848.  
  1849.  
  1850.  
  1851.  
  1852. CSH                       User Commands                       CSH
  1853.  
  1854.  
  1855.  
  1856.      --ff   The shell will start faster, because it will neither
  1857.           search for nor execute commands from the file `.cshrc'
  1858.           in the invoker's home directory.
  1859.  
  1860.      --ii   The shell is interactive and prompts for its top-level
  1861.           input, even if it appears to not be a terminal.  Shells
  1862.           are interactive without this option if their inputs and
  1863.           outputs are terminals.
  1864.  
  1865.      --nn   Commands are parsed, but not executed.  This aids in
  1866.           syntactic checking of shell scripts.
  1867.  
  1868.      --ss   Command input is taken from the standard input.
  1869.  
  1870.      --tt   A single line of input is read and executed.  A `\' may
  1871.           be used to escape the newline at the end of this line
  1872.           and continue onto another line.
  1873.  
  1874.      --vv   Causes the _v_e_r_b_o_s_e variable to be set, with the effect
  1875.           that command input is echoed after history substitu-
  1876.           tion.
  1877.  
  1878.      --xx   Causes the _e_c_h_o variable to be set, so that commands
  1879.           are echoed immediately before execution.
  1880.  
  1881.      --VV   Causes the _v_e_r_b_o_s_e variable to be set even before
  1882.           `.cshrc' is executed.
  1883.  
  1884.      --XX   Is to --xx as --VV is to --vv..
  1885.  
  1886.      After processing of flag arguments, if arguments remain but
  1887.      none of the --cc,, --ii,, --ss,, or --tt options was given, the first
  1888.      argument is taken as the name of a file of commands to be
  1889.      executed.  The shell opens this file, and saves its name for
  1890.      possible resubstitution by `$0'.  Since many systems use
  1891.      either the standard version 6 or version 7 shells whose
  1892.      shell scripts are not compatible with this shell, the shell
  1893.      will execute such a `standard' shell if the first character
  1894.      of a script is not a `#', i.e. if the script does not start
  1895.      with a comment.  Remaining arguments initialize the variable
  1896.      _a_r_g_v.
  1897.  
  1898.      SSiiggnnaall hhaannddlliinngg
  1899.  
  1900.      The shell normally ignores _q_u_i_t signals.  Jobs running
  1901.      detached (either by `&' or the _b_g or %%...... && commands) are
  1902.      immune to signals generated from the keyboard, including
  1903.      hangups.  Other signals have the values which the shell
  1904.      inherited from its parent.  The shells handling of inter-
  1905.      rupts and terminate signals in shell scripts can be con-
  1906.      trolled by _o_n_i_n_t_r. Login shells catch the _t_e_r_m_i_n_a_t_e signal;
  1907.      otherwise this signal is passed on to children from the
  1908.  
  1909.  
  1910.  
  1911. Sprite v1.0              April 24, 1988                        29
  1912.  
  1913.  
  1914.  
  1915.  
  1916.  
  1917.  
  1918. CSH                       User Commands                       CSH
  1919.  
  1920.  
  1921.  
  1922.      state in the shell's parent.  In no case are interrupts
  1923.      allowed when a login shell is reading the file `.logout'.
  1924.  
  1925. AAUUTTHHOORR
  1926.      William Joy.  Job control and directory stack features first
  1927.      implemented by J.E. Kulp of I.I.A.S.A, Laxenburg, Austria,
  1928.      with different syntax than that used now.  File name comple-
  1929.      tion code written by Ken Greer, HP Labs.
  1930.  
  1931. FFIILLEESS
  1932.      ~/.cshrc         Read at beginning of execution by each shell.
  1933.      ~/.login         Read by login shell, after `.cshrc' at login.
  1934.      ~/.logout        Read by login shell, at logout.
  1935.      /bin/sh          Standard shell, for shell scripts not starting with a `#'.
  1936.      /tmp/sh*         Temporary file for `<<'.
  1937.      /etc/passwd      Source of home directories for `~name'.
  1938.  
  1939. LLIIMMIITTAATTIIOONNSS
  1940.      Words can be no longer than 1024 characters.  The system
  1941.      limits argument lists to 10240 characters.  The number of
  1942.      arguments to a command which involves filename expansion is
  1943.      limited to 1/6'th the number of characters allowed in an
  1944.      argument list.  Command substitutions may substitute no more
  1945.      characters than are allowed in an argument list.  To detect
  1946.      looping, the shell restricts the number of _a_l_i_a_s substitu-
  1947.      tions on a single line to 20.
  1948.  
  1949. SSEEEE AALLSSOO
  1950.      sh(1), access(2), execve(2), fork(2), killpg(2), pipe(2),
  1951.      sigvec(2), umask(2), setrlimit(2), wait(2), tty(4),
  1952.      a.out(5), environ(7), `An introduction to the C shell'
  1953.  
  1954. BBUUGGSS
  1955.      When a command is restarted from a stop, the shell prints
  1956.      the directory it started in if this is different from the
  1957.      current directory; this can be misleading (i.e. wrong) as
  1958.      the job may have changed directories internally.
  1959.  
  1960.      Shell builtin functions are not stoppable/restartable.  Com-
  1961.      mand sequences of the form `a ; b ; c' are also not handled
  1962.      gracefully when stopping is attempted.  If you suspend `b',
  1963.      the shell will then immediately execute `c'.  This is espe-
  1964.      cially noticeable if this expansion results from an _a_l_i_a_s.
  1965.      It suffices to place the sequence of commands in ()'s to
  1966.      force it to a subshell, i.e. `( a ; b ; c )'.
  1967.  
  1968.      Control over tty output after processes are started is prim-
  1969.      itive; perhaps this will inspire someone to work on a good
  1970.      virtual terminal interface.  In a virtual terminal interface
  1971.      much more interesting things could be done with output con-
  1972.      trol.
  1973.  
  1974.  
  1975.  
  1976.  
  1977. Sprite v1.0              April 24, 1988                        30
  1978.  
  1979.  
  1980.  
  1981.  
  1982.  
  1983.  
  1984. CSH                       User Commands                       CSH
  1985.  
  1986.  
  1987.  
  1988.      Alias substitution is most often used to clumsily simulate
  1989.      shell procedures; shell procedures should be provided rather
  1990.      than aliases.
  1991.  
  1992.      Commands within loops, prompted for by `?', are not placed
  1993.      in the _h_i_s_t_o_r_y list.  Control structure should be parsed
  1994.      rather than being recognized as built-in commands.  This
  1995.      would allow control commands to be placed anywhere, to be
  1996.      combined with `|', and to be used with `&' and `;' metasyn-
  1997.      tax.
  1998.  
  1999.      It should be possible to use the `:' modifiers on the output
  2000.      of command substitutions.  All and more than one `:' modif-
  2001.      ier should be allowed on `$' substitutions.
  2002.  
  2003.      The way the ffiilleecc facility is implemented is ugly and expen-
  2004.      sive.
  2005.  
  2006.  
  2007.  
  2008.  
  2009.  
  2010.  
  2011.  
  2012.  
  2013.  
  2014.  
  2015.  
  2016.  
  2017.  
  2018.  
  2019.  
  2020.  
  2021.  
  2022.  
  2023.  
  2024.  
  2025.  
  2026.  
  2027.  
  2028.  
  2029.  
  2030.  
  2031.  
  2032.  
  2033.  
  2034.  
  2035.  
  2036.  
  2037.  
  2038.  
  2039.  
  2040.  
  2041.  
  2042.  
  2043. Sprite v1.0              April 24, 1988                        31
  2044.  
  2045.  
  2046.  
  2047.